/* 全局样式 - Tailwind 风格 */
:root {
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-900: #1e3a8a;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --gradient-brand: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 登录注册页面样式 - Premium Design */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-brand);
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.03"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 48px;
    border-radius: 24px;
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 440px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 32px;
    color: var(--gray-900);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--gray-700);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.025em;
}

.form-control {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--gray-200);
    border-radius: 16px;
    font-size: 16px;
    font-weight: 400;
    background: var(--gray-50);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--gray-900);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-500);
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.025em;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
    width: 100%;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-900));
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.auth-link {
    text-align: center;
    margin-top: 20px;
}

.auth-link a {
    color: #007aff;
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* 主应用布局 - Modern Design */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--gray-50);
}

.sidebar {
    width: 320px;
    background: white;
    border-right: 1px solid var(--gray-200);
    padding: 0;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 10;
}

.sidebar-header {
    padding: 32px 24px;
    border-bottom: 1px solid var(--gray-100);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--gray-50) 100%);
}

.sidebar-header h2 {
    color: var(--gray-900);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    margin: 4px 16px;
    color: var(--gray-600);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    border-radius: 12px;
    text-align: left;
    background: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    position: relative;
    gap: 12px;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--primary-500);
    border-radius: 2px;
    transition: height 0.2s ease;
}

.nav-item:hover {
    background: var(--primary-50);
    color: var(--primary-700);
    transform: translateX(4px);
}

.nav-item:hover::before {
    height: 20px;
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.nav-item.active::before {
    height: 24px;
    background: white;
}

.main-content {
    flex: 1;
    background: var(--gray-50);
    overflow-y: auto;
    position: relative;
}

.content-header {
    background: white;
    padding: 32px 40px;
    border-bottom: 1px solid var(--gray-100);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: var(--shadow-sm);
}

.content-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.025em;
    margin: 0;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.content-body {
    padding: 40px;
    max-width: 1200px;
}

/* 常用词模块样式 */
.word-categories {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e5e5e7;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #424245;
}

.category-btn.active {
    background: #007aff;
    border-color: #007aff;
    color: white;
}

.category-btn:hover {
    border-color: #007aff;
}

.words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.word-tag {
    padding: 8px 12px;
    background: white;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 14px;
    color: #424245;
}

.word-tag:hover {
    border-color: #007aff;
    color: #007aff;
}

/* 对话生成样式 */
.conversation-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.conversation-header {
    padding: 20px 24px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e5e7;
}

.conversation-input {
    padding: 24px;
}

.input-area {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.input-area textarea {
    width: 100%;
    border: none;
    background: none;
    resize: vertical;
    min-height: 80px;
    font-size: 14px;
    color: #1d1d1f;
}

.input-area textarea:focus {
    outline: none;
}

.input-area textarea::placeholder {
    color: #8e8e93;
}

.conversation-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quick-words {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.conversation-output {
    padding: 24px;
    border-top: 1px solid #e5e5e7;
    background: #fafafa;
}

.output-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #e5e5e7;
    position: relative;
}

.output-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-copy {
    background: #34c759;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-copy:hover {
    background: #28a745;
    transform: translateY(-1px);
}

/* 设置页面样式 */
.settings-container {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.settings-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e5e7;
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1d1d1f;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.setting-label {
    color: #424245;
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    background: #e5e5e7;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch.active {
    background: #007aff;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch.active::after {
    transform: translateX(26px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e5e7;
    }
    
    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 8px 16px;
    }
    
    .nav-item {
        white-space: nowrap;
        padding: 8px 16px;
    }
    
    .words-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .conversation-controls {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e5e7;
    border-radius: 50%;
    border-top-color: #007aff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-text {
    visibility: hidden;
    width: 120px;
    background-color: #1d1d1f;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* 成功和错误消息 */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}